//
//  WPhotosBrowserView.h
//  PhotosBrowser
//
//  Created by winter on 2016/10/24.
//  Copyright © 2016年 JHJR. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "WPhotoShowView.h"
@class WPhotosBrowserView;

@protocol WPhotosBrowserViewDelegate <NSObject>
@optional

/**
 * 图片浏览将要显示时调用
 */
- (void)photoBrowseView:(WPhotosBrowserView *)photoBrowserView willShowWithImages:(NSArray *)images index:(NSInteger)index;
/**
 * 图片浏览已经显示时调用
 */
- (void)photoBrowseView:(WPhotosBrowserView *)photoBrowserView didShowWithImages:(NSArray *)images index:(NSInteger)index;
/**
 * 图片浏览将要隐藏时调用
 */
- (void)photoBrowseView:(WPhotosBrowserView *)photoBrowserView willHiddenWithImages:(NSArray *)images index:(NSInteger)index;
/**
 * 图片浏览已经隐藏时调用
 */
- (void)photoBrowseView:(WPhotosBrowserView *)photoBrowserView didHiddenWithImages:(NSArray *)images index:(NSInteger)index;
/**
 * 图片单击时调用
 */
- (void)photoBrowseView:(WPhotosBrowserView *)photoBrowserView didSingleClickedImage:(UIImage *)image index:(NSInteger)index;
/**
 * 图片长按时调用
 */
- (void)photoBrowseView:(WPhotosBrowserView *)photoBrowserView didLongPressImage:(UIImage *)image index:(NSInteger)index;

@end

@protocol WPhotosBrowserViewDataSource <NSObject>

/** 返回将要浏览的图片链接数组 **/
- (NSArray<NSString *> *)imageUrlsForBrowserWithView:(WPhotosBrowserView *)photosBrowserView;

@optional
/** 返回将要浏览的图片的缩略图地址数组（数目与图片地址数目须一直） （如果没有，则显示默认背景图）*/
- (NSArray<NSString *> *)thumbnailUrlsForBrowserWithView:(WPhotosBrowserView *)photosBrowserView;

/** 页面显示最初的位置view（点击view） 默认左上角*/
- (UIView *)photosBrowserViewWillShowAtLocationViewWithIndex:(NSInteger)index;
/** 页面消失的位置view（点击view） 默认左上角*/
- (UIView *)photosBrowserViewWillHideAtLocationViewWithIndex:(NSInteger)index;
@end

@interface WPhotosBrowserView : UIView

@property (nonatomic, weak) id<WPhotosBrowserViewDelegate> delegate;
@property (nonatomic, weak) id<WPhotosBrowserViewDataSource> dataSource;

+ (instancetype)photosBrowserView;
+ (instancetype)photosBrowserViewWithDelegate:(id<WPhotosBrowserViewDelegate>)delegate;
+ (instancetype)photosBrowserViewWithDataSource:(id<WPhotosBrowserViewDataSource>)dataSource;
+ (instancetype)photosBrowserViewWithDelegate:(id<WPhotosBrowserViewDelegate>)delegate dataSource:(id<WPhotosBrowserViewDataSource>)dataSource;

- (void)showWithIndex:(NSInteger)index;
- (void)hideWithIndex:(NSInteger)index;
@end
